<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head th:replace="adminCommon::common-header"></head>
<body class="sb-nav-fixed">
<nav th:replace="adminCommon::common-navbar"></nav>
<div id="layoutSidenav">
    <div th:replace="adminCommon::common-sidenav"></div>

    <div id="layoutSidenav_content">
        <main>
            <div class="container-fluid px-4">
                <h1 class="mt-4">编辑教练</h1>

                <ol class="breadcrumb mb-4">
                    <li class="breadcrumb-item"><a th:href="@{/toCoachMain}">主页</a></li>
                    <li class="breadcrumb-item"><a th:href="@{/coach/selCoach}">教练管理</a></li>
                    <li class="breadcrumb-item active">编辑教练</li>
                </ol>

                <div class="card mb-4">

                    <form th:action="@{/coach/updateCoach}" method="post" name="updateForm"
                          onsubmit="return beforeSubmit(this)">
                        <table class="table table-hover">
                            <tr>
                                <td text-align="center">教练id：</td>
                                <td><input type="text" class="form-control" readonly="readonly"
                                           th:value="${coach.coachId}" name="coachId">
                                </td>
                            </tr>
                            <tr>
                                <td text-align="center">姓名：</td>
                                <td><input type="text" class="form-control" th:value="${coach.coachName}"
                                           name="coachName"></td>
                            </tr>
                            <tr>
                                <td text-align="center">密码：</td>
                                <td><input type="text" class="form-control"
                                           th:value="${coach.coachPassword}" name="coachPassword">
                                </td>
                            </tr>
                            <tr>
                                <td text-align="center">性别：</td>
                                <td><input type="text" class="form-control" th:value="${coach.coachGender}"
                                           name="coachGender">
                                </td>
                            </tr>
                            <tr>
                                <td text-align="center">年龄：</td>
                                <td><input type="text" class="form-control" th:value="${coach.coachAge}"
                                           name="coachAge">
                                </td>
                            </tr>
                            <tr>
                                <td text-align="center">联系方式：</td>
                                <td><input type="text" class="form-control" th:value="${coach.coachPhone}"
                                           name="coachPhone">
                                </td>
                            </tr>
                            <tr>
                                <td text-align="center">薪资：</td>
                                <td><input type="text" class="form-control" th:value="${coach.coachSlave}"
                                           name="coachSlave">
                                </td>
                            </tr>
                        </table>
                        <div style="text-align:center;margin-bottom:15px">
                            <input type="submit" class="btn btn-outline-success" value="确认修改">
                        </div>
                    </form>
                </div>
            </div>
        </main>
        <footer th:replace="adminCommon::common-footer"></footer>
    </div>
</div>

<div th:include="adminCommon::common-scripts"></div>
<script type="text/javascript">
    function beforeSubmit(updateForm) {
        let phone = /^[1][3,4,5,7,8,9][0-9]{9}$/;//设置手机号正则表达式
        if (!phone.test(updateForm.coachPhone.value)) {
            alert("手机号码格式错误！");
            return false;
        }
        return true;
    }
</script>
</body>
</html>
